<template>
  <div class="inbo">
    <el-form-item :label="label1">
      <el-date-picker v-model="value1" type="date" placeholder="开始日期" @change="sjfwfun">
      </el-date-picker>
    </el-form-item>
    <el-form-item :label="label2">
      <el-date-picker v-model="value2" type="date" placeholder="结束日期" @change="sjfwfun">
      </el-date-picker>
    </el-form-item>
  </div>
</template>

<script>
import dayjs from 'dayjs'
export default {
  data() {
    return {
      value1: dayjs().subtract(1, 'day').subtract(6, 'month').format('YYYY-MM-DD'),
      value2: dayjs().subtract(0, 'day').format('YYYY-MM-DD')
    }
  },
  props: {
    label1: {
      type: String,
      default: "开始日期"
    },
    label2: {
      type: String,
      default: "结束日期"
    },
  },
  mounted() {
    this.sjfwfun1()
  },
  computed: {

  },
  methods: {
    sjfwfun() {
      if (this.value1 && this.value2) {
        this.$emit("fun", dayjs(this.value1).format('YYYY-MM-DD'),
          dayjs(this.value2).format('YYYY-MM-DD'));
      }
    },
    sjfwfun1() {
      this.$emit("fun", dayjs().subtract(1, 'day').subtract(6, 'month').format('YYYY-MM-DD'),
        dayjs().subtract(0, 'day').format('YYYY-MM-DD'));
    },
  }
};
</script>

<style scoped>
.inbo{
  display: inline-block;
}
.pagination-container {
  /* background: #fff; */
  padding: 23px 0 20px;
}

.pagination-container.hidden {
  display: none;
}
</style>